procedure delLadHwirdRec:
define input parameter hwirdnbr like hwird_nbr.
DEFINE INPUT PARAMETER hwirpart LIKE hwird_part.

find first hwir_mstr no-lock where hwir_nbr = hwirdnbr no-error.
if avail hwir_mstr then do:
    find first wo_mstr no-lock where wo_nbr = hwir_wo no-error.
    if avail wo_mstr then do:        
   for each hwird_det where
            hwird_nbr = hwirdnbr
       /* and hwird_qty_chg <> 0 */
   exclusive-lock:
     /* DECREASE THE IN_MSTR ALLOCATED QTY */

      /* DELETE THE LAD_DET RECORD(S) (DETAIL ALLOCATIONS) */
      for each lad_det where
               lad_dataset = "hwird_det"
           and lad_nbr     = wo_lot
           and lad_line    = hwirdnbr
           and lad_part    = hwirpart
      exclusive-lock:
         find ld_det where
              ld_part = lad_part and
              ld_site = lad_site and
              ld_loc  = lad_loc  and
              ld_lot  = lad_lot  and
              ld_ref  = lad_ref
         exclusive-lock no-error.
         if available ld_det THEN DO:
/*              ld_qty_all = ld_qty_all - lad_qty_all.  */
             ld_qty_all = ld_qty_all - lad_qty_pick.
         END.

      find in_mstr where
           in_part = lad_part and
           in_site = lad_site
      exclusive-lock no-error.
      if available in_mstr THEN DO:
/*           in_qty_all = in_qty_all - lad_qty_all.  */
          in_qty_all = in_qty_all - lad_qty_pick.
      END.

         delete lad_det.
      end. /* FOR EACH lad_det */
      /* RESTORE THE WOD_QTY_ALL TO 0 IF PREVIOUS WOD_STATUS <> "A" */
     /* hwird_qty_chg = 0.*/
   end. /* FOR EACH hwird_det */
    end. /*if avail wo_mstr then do:*/
end. /* if avail hwir_mstr then do: */
 
end procedure.
